<template>
    <el-card>
        <el-table border style="margin: 10px 0px;" :data="skuArr">
            <el-table-column type="index" label="序号" width="80px" align="center" />
            <el-table-column label="名称" show-overflow-tooltip width="200px"></el-table-column>
            <el-table-column label="描述" show-overflow-tooltip width="200px"></el-table-column>
            <el-table-column label="图片" width="200px"></el-table-column>
            <el-table-column label="重量(g)" width="200px"></el-table-column>
            <el-table-column label="价格(元)"></el-table-column>
            <el-table-column label="操作" width="300px" fixed="right">
                <template #="{ }">
                    <el-button type="primary" size="default" icon="Top"></el-button>
                    <el-button type="primary" size="default" icon="Edit"></el-button>
                    <el-button type="primary" size="default" icon="InfoFilled" @click="findSKu"></el-button>
                    <el-button type="primary" size="default" icon="Delete"></el-button>
                </template>
            </el-table-column>
        </el-table>

        <el-pagination v-model:current-page="pageNo" v-model:page-size="pageSize" :page-sizes="[10, 20, 30, 40]"
            :background="true" layout="prev, pager, next, jumper, ->, sizes,total" :total="400" />

        <!-- 抽屉组件显示详情 -->
        <el-drawer v-model="drawer">
            <template #header>
                <h4>查看商品详情</h4>
            </template>
            <template #default>
                <el-row style="margin: 10px 0px;">
                    <el-col :span="6">名称</el-col>
                    <el-col :span="18">华为Mata20</el-col>
                </el-row>

                <el-row style="margin: 10px 0px;">
                    <el-col :span="6">描述</el-col>
                    <el-col :span="18">华为YYDS</el-col>
                </el-row>

                <el-row style="margin: 10px 0px;">
                    <el-col :span="6">价格</el-col>
                    <el-col :span="18">6920</el-col>
                </el-row>

                <el-row style="margin: 10px 0px;">
                    <el-col :span="6">平台属性</el-col>
                    <el-col :span="18">
                        <el-tag type="primary">Tag 1</el-tag>
                    </el-col>
                </el-row>

                <el-row style="margin: 10px 0px;">
                    <el-col :span="6">销售属性</el-col>
                    <el-col :span="18">
                        <el-tag type="primary">Tag 1</el-tag>
                    </el-col>
                </el-row>

                <el-row style="margin: 10px 0px;">
                    <el-col :span="6">商品图片</el-col>
                    <el-col :span="18">
                        <el-carousel :interval="4000" type="card" height="200px">
                            <el-carousel-item v-for="item in 6" :key="item">
                                <h3 text="2xl" justify="center">{{ item }}</h3>
                            </el-carousel-item>
                        </el-carousel>
                    </el-col>
                </el-row>

            </template>
        </el-drawer>
    </el-card>
</template>

<script setup lang='ts' name='Sku'>
import { ref } from 'vue';

let pageNo = ref<number>(1);
let pageSize = ref<number>(10);
// 控制抽屉显示与隐藏
let drawer = ref<boolean>(false);

let skuArr = ref<any>([{
    name: "sss"
}])

/// 查看详情
const findSKu = () => {
    drawer.value = true;
}

</script>

<style scoped lang='scss'>
.el-carousel__item h3 {
    color: #475669;
    opacity: 0.75;
    line-height: 200px;
    margin: 0;
    text-align: center;
}

.el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
    background-color: #d3dce6;
}

.el-carousel {
    --el-carousel-indicator-width: 15px;
}
</style>